package com.itfox.day08.fastJson;

import com.alibaba.fastjson.JSON;
import com.itfox.day08.pojo.User;

import java.util.ArrayList;
import java.util.Collections;

public class demo {
    public static void main(String[] args) {
        User user = new User("熊大", "123");

        String jsonString = JSON.toJSONString(user);
        System.out.println(jsonString);

        ArrayList<User> users = new ArrayList<>();
        Collections.addAll(users,  new User("熊大","123"),
                                   new User("熊二","1234"),
                                   new User("翠花","12345") );
        String jsonString1 = JSON.toJSONString(users);
        System.out.println(jsonString1);
    }
}
